home *** CD-ROM | disk | FTP | other *** search
- {
- Funtion CountDigits accepts a positive integer as a
- parameter and returns the number of digits in the integer.
-
- }
-
- function
- CountDigits ( num : integer ): integer;
-
- VAR
-
- Digits : integer;
-
-
- BEGIN {CountDigits}
-
- Digits := 0;
-
- While ( num > 0 ) do begin
- Digits := Digits + 1;
- num := num div 10
- end; {While}
-
- CountDigits := Digits
-
- END; {CountDigits}
-